<?php
namespace lisPHP;
/**
 * 路由
 * author      : lis
 * creatTime   : 2015-12-29 15:03
 * email       : 407505297@qq.com
 * description :路由设置
 */
class Route{
    /**
     * 分析URL
     */
    public function parse(){
        $pathInfo = !empty($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : array();
        $appName = !empty($pathInfo[1]) ? $pathInfo[1] : getConfig('DEFAULT_APP_NAME');
        $className = !empty($pathInfo[2]) ? $pathInfo[2] : getConfig('DEFAULT_CONTROLLER');
        $methodName = !empty($pathInfo[3]) ? $pathInfo[3] : getConfig('DEFAULT_METHOD');
        $c = $appName . '\Controller\\' . $className.'Controller';
        $obj = new $c();
        $obj->$methodName();
    }
}
?>